﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OneTwoTeam.EasyScrum.DAL
{
    public static class DatabaseFacade
    {
        public static List<user> GetUserForId(int id)
        {
            List<user> _users;

            using (var context = new easyscrumEntities())
            {
                var query = from x in context.user
                            where x.id == id
                            select x;
                _users = query.ToList();

            }

            return _users;
        }


        public static List<user> GetUsersByRole(role role)
        {
            List<user> _users;

            using (var context = new easyscrumEntities())
            {
                var query = from x in context.user
                            where x.role == role
                            select x;
                _users = query.ToList();

            }

            return _users;
        }

        public static List<role> GetRoleByLibelle(string libelle_role)
        {
            List<role> _role;

            using (var context = new easyscrumEntities())
            {
                var query = from x in context.role
                            where x.libelle == libelle_role
                            select x;
                _role = query.ToList();

            }

            return _role;
        }



    }
}
